$('.datatable-basic').DataTable({
	 "ajax" : {
		"url" : contextpath + "bookRecord/list",
		"data" : function(d) {
            var query = $("#query").serializeObject();
            query["size"] = d.length;
            query["page"] = (d.start/d.length);
			return query;
		},
		"dataFilter": function(data){
            var json = jQuery.parseJSON( data );
            json.recordsTotal = json.totalElements;
            json.recordsFiltered = json.totalElements;
            json.data = json.content;
 
            return JSON.stringify( json );
        }
	 },
	 "columns": [
         { "data": "customerName" },
         { "data": "productName" },
         { "data": "bookDate" },
         {
        	 render : function(data, type, row, meta) {
        		 if(row.remark && row.remark.length > 10){
        			 return "<span class='text-info' title='" + row.remark + "'>" + row.remark.substring(0,10) + "..."  + "</span>";
        		 }else{
        			 return row.remark;
        		 }
        	 }
         }
     ],
     "drawCallback": function( settings ) {
      }
});

$(function(){
	$("#submit").click(function(){
		$('.datatable-basic').DataTable().draw();
	});

	$('select').select2({
	    minimumResultsForSearch: Infinity
	});	
	
})

